package com.exercise.poly_.polyparameter;

public class Test {
    public static void main(String[] args) {
        Worker tom = new Worker("tom", 3600);
        Manager lihua = new Manager("lihua", 6000, 5000);
        Test test = new Test();
        test.ShowEmpYearsalary(tom);
        test.ShowEmpYearsalary(lihua);

        test.testWork(tom);
        test.testWork(lihua);

    }

    public void ShowEmpYearsalary(Employee e){
        System.out.println(e.yearsalary());
    }
    public void testWork(Employee e){
        if(e instanceof Worker){
            ((Worker)e).work();
        }
        else if(e instanceof Manager){
            ((Manager) e).manage();
        }

    }

}

